package com.jobs.enumDemo;

import java.util.Arrays;
import java.util.Objects;

/**
 * @Author 王博
 * @DateTime 2024-07-31 09:20
 */
public class EnumMain {
    public static void main(String[] args) {
        testGenderEnum();
        testTypeEnum();
    }

    private static void testGenderEnum(){
        GenderEnum MALEENUM = GenderEnum.MALE;
        System.out.println(MALEENUM);
        System.out.println(MALEENUM.name());
        System.out.println(GenderEnum.valueOf("MALE"));
        System.out.println(GenderEnum.valueOf("MALE")==MALEENUM);
        System.out.println(GenderEnum.valueOf("MALE").equals(MALEENUM));
        System.out.println(Objects.equals(GenderEnum.valueOf("MALE"), MALEENUM));
        System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
    }

    private static void testTypeEnum(){
        TypeEnum typeEnum = TypeEnum.TYPE_1;
        TypeEnum type2Enum = TypeEnum.TYPE_2;
        System.out.println(typeEnum.getDesc());
        System.out.println(typeEnum.getType());
        System.out.println(typeEnum.ordinal());
        System.out.println(type2Enum.ordinal());
        System.out.println(typeEnum.name());
        System.out.println(typeEnum.toString());
        System.out.println(typeEnum);
        System.out.println(TypeEnum.valueOf("TYPE_1")==typeEnum);
        System.out.println("**********************");
        Arrays.stream(TypeEnum.values()).forEach(System.out::println);
    }
}
